/**
 * Copyright © 2021 易久批信息技术有限公司. All rights reserved.
 */
package com.dysm.binarytree;

/**
 *
 * @author xiay
 * @since 2021/1/18 10:46 下午
 */
public class BinaryTreeTest {

    public static void main(String[] args) {

        MyNode node5 = new MyNode(5, null, null);
        MyNode node4 = new MyNode(4, null, node5);

        MyNode node7 = new MyNode(7, null, null);
        MyNode node6 = new MyNode(6, null, node7);
        MyNode node3 = new MyNode(3, null, null);
        MyNode node2 = new MyNode(2, node3, node6);
        MyNode node1 = new MyNode(1, node4, node2);


        BinaryTree binaryTree = new BinaryTreeImpl(node1);
        boolean empty = binaryTree.isEmpty();
        System.out.println(empty);

        System.out.print("先序遍历:");
        binaryTree.beforeTraverse();
        System.out.println();

        System.out.print("中序遍历:");
        binaryTree.centerTraverse();
        System.out.println();

        System.out.print("后序遍历:");
        binaryTree.afterTraverse();
        System.out.println();

        System.out.println("二叉树高度:" + binaryTree.getHeight());
        System.out.println("二叉树节点数:" + binaryTree.getSize());

        System.out.println("查找key:" + binaryTree.findKey(1));
    }
}
